﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnrealDebugger.Panels;

namespace UnrealDebugger
{
    // Events

    partial class UnrealDebuggerIDE
    {
        public delegate void ReadUserDataDelegate(SerializableDictionary<string, string> userData);
        public event ReadUserDataDelegate OnReadUserData;

        public delegate void WriteUserDataDelegate(SerializableDictionary<string, string> userData);
        public event WriteUserDataDelegate OnWriteUserData;

        public delegate void ProjectLoadedDelegate(string filename);
        public event ProjectLoadedDelegate OnProjectLoaded;

        public delegate void ProjectPathChangedDelegate(string path, string[] filters);
        public event ProjectPathChangedDelegate OnProjectPathChanged;

        public delegate void EditorPropertiesChangedDelegate();
        public event EditorPropertiesChangedDelegate OnEditorPropertiesChanged;

        public delegate void DocumentOpenedDelegate(Document document);
        public event DocumentOpenedDelegate OnDocumentOpened;

        public delegate void DocumentClosedDelegate(Document document);
        public event DocumentClosedDelegate OnDocumentClosed;

        public delegate void DocumentActivatedDelegate(Document document);
        public event DocumentActivatedDelegate OnDocumentActivated;

        public delegate void DebuggerAttachedDelegate();
        public event DebuggerAttachedDelegate OnDebuggerAttached;

        public delegate void DebuggerDetachedDelegate();
        public event DebuggerDetachedDelegate OnDebuggerDetached;

        public delegate void BreakpointsChangedDelegate(MultiMap<string, Breakpoint> breakpoints);
        public event BreakpointsChangedDelegate OnBreakpointsChanged;

        public void RaiseReadUserData(SerializableDictionary<string, string> userData)
        {
            if (this.OnReadUserData != null) { OnReadUserData(userData); }
        }

        public void RaiseWriteUserData(SerializableDictionary<string, string> userData)
        {
            if (this.OnWriteUserData != null) { OnWriteUserData(userData); }
        }

        public void RaiseProjectLoaded(string filename)
        {
            if (this.OnProjectLoaded != null) { OnProjectLoaded(filename); }
        }

        public void RaiseProjectPathChanged(string path, string[] filters)
        {
            if (this.OnProjectPathChanged != null) { OnProjectPathChanged(path, filters); }
        }

        public void RaiseEditorPropertiesChanged()
        {
            if (this.OnEditorPropertiesChanged != null) { OnEditorPropertiesChanged(); }
        }

        public void RaiseDocumentOpened(Document document)
        {
            if (this.OnDocumentOpened != null) { OnDocumentOpened(document); }
        }

        public void RaiseDocumentClosed(Document document)
        {
            if (this.OnDocumentClosed != null) { OnDocumentClosed(document); }
        }

        public void RaiseDocumentActivated(Document document)
        {
            if (this.OnDocumentActivated != null) { OnDocumentActivated(document); }
        }

        public void RaiseDebuggerAttached()
        {
            if (this.OnDebuggerAttached != null) { OnDebuggerAttached(); }
        }

        public void RaiseDebuggerDetached()
        {
            if (this.OnDebuggerDetached != null) { OnDebuggerDetached(); }
        }

        public void RaiseBreakpointsChanged(MultiMap<string, Breakpoint> breakpoints)
        {
            if (this.OnBreakpointsChanged != null) { OnBreakpointsChanged(breakpoints); }
        }
    }
}
